package com.budwk.app.sqfwV2.enums;

import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/**
 * 宣传/排查记录
 */
@Getter
public enum PropagandaOrScreeningEnum {
    PROPAGANDA("1", "宣传记录","宣传/排查记录", "宣传记录表", "【宣传记录表】合集",
            "宣传模板", "pdf", "/preview/xcpc/xc_pdf.png"),
    SCREENING("2", "排查记录", "宣传/排查记录","排查记录表", "【排查记录表】合集",
            "排查模板", "pdf", "/preview/xcpc/pc_pdf.png"),
    PROPAGANDA_SCREENING("3", "宣传排查记录台账", "宣传/排查记录",
            "宣传排查记录台账", "【宣传排查记录】台账",
            "宣传排查记录模板", "excel", "/preview/xcpc/xc_pc_excel.png"),
    ;

    private String code;
    private String name;
    private String type;
    private String oneName;
    private String compilationName;
    private String templateName;
    private String fileType;
    private String img;

    PropagandaOrScreeningEnum(String code, String name, String type, String oneName, String compilationName, String templateName, String fileType, String img) {
        this.name = name;
        this.code = code;
        this.type = type;
        this.oneName = oneName;
        this.compilationName = compilationName;
        this.templateName = templateName;
        this.fileType = fileType;
        this.img = img;
    }

    public static String getName(String code) {
        for (PropagandaOrScreeningEnum o : PropagandaOrScreeningEnum.values()) {
            if (o.getCode().equals(code)) {
                return o.getName();
            }
        }
        return null;
    }
    public static PropagandaOrScreeningEnum getEnum(String code) {
        for (PropagandaOrScreeningEnum o : PropagandaOrScreeningEnum.values()) {
            if (o.getCode().equals(code)) {
                return o;
            }
        }
        return null;
    }

    public static String getCompilationName(String code) {
        for (PropagandaOrScreeningEnum o : PropagandaOrScreeningEnum.values()) {
            if (o.getCode().equals(code)) {
                return o.getCompilationName();
            }
        }
        return null;
    }

    public static List<PropagandaOrScreeningEnum> getPdf() {
        List<PropagandaOrScreeningEnum> list = new ArrayList<>();
        for (PropagandaOrScreeningEnum o : PropagandaOrScreeningEnum.values()) {
            if (o.getFileType().equals("pdf")) {
                list.add(o);
            }
        }
        return list;
    }

    public static List<PropagandaOrScreeningEnum> getExcel() {
        List<PropagandaOrScreeningEnum> list = new ArrayList<>();
        for (PropagandaOrScreeningEnum o : PropagandaOrScreeningEnum.values()) {
            if (o.getFileType().equals("excel")) {
                list.add(o);
            }
        }
        return list;
    }
    
}
